extends Control
@onready var animation_player: AnimationPlayer = $AnimationPlayer

func _ready():
	hide_game_over()
	
func _input(event:InputEvent) -> void:
	get_window().set_input_as_handled()
	
	if animation_player.is_playing():
		return
	
	if (event is InputEventKey or 
		event is InputEventMouseButton or
		event is InputEventJoypadButton
	):
		if event.is_pressed() and not event.is_echo():
			hide_game_over()
			if Game.has_save():
				Game.load_game()
			else:
				Game.back_to_title()
			
func show_game_over() -> void:
	show()
	# 允许玩家输入
	set_process_input(true)
	
func hide_game_over() -> void:
	hide()
	# 禁用玩家输入
	set_process_input(false)
	
	

